Developer Documentation
PATHJava Developer Documentation > Mac OS Runtime for Java > MRJToolkit > Programming With MRJToolkit


Methods


setItemCmdKey

Sets a key as a keyboard equivalent for a menu item.

public static final void setMenuItemCmdKey (Menu menu,
                     int itemIndex, char ch);
public static final void setMenuItemCmdKey (MenuItem item, char ch);
menu
The name of the menu that contains the desired menu item.
itemindex
The index number of the menu item. This index is zero-based.
ch
The character to set as the keyboard equivalent. The menu item is activated by selecting Command + ch .
item
The name of the desired menu item.

DISCUSSION

You can specify the menu item by its name or by indicating the menu that contains it and its index number (the first item in the menu has index 0, the second has index 1, and so on). You can assign only one character to act as the keyboard equivalent (for example, "A" but not "option- A"). For example, if you assign G as the character, Command-G selects the menu item.

SEE ALSO

The "Menu Manager" chapter in Inside Macintosh: Macintosh Toolbox Essentials .


© 1998 Apple Computer, Inc. — (Last Updated 10 Dec 98)